package la.bbs558.util;

/**
 * @author: Shanks
 * @date: 2024/1/25 11:42
 * @desc:
 */
public class ValidUtils {

    private static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
    private static final String CHINESE_PHONE_REGEX = "^((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(166)|(17[0135678])|(18[0-9])|(19[8|9]))\\d{8}$";


    public static  boolean isCNPhone(String phone) {
        return phone.matches(CHINESE_PHONE_REGEX);
    }

    public static boolean isEmail(String username) {
        return username.matches(EMAIL_REGEX);
    }
}
